package MIDlet;
import Managers.FlunkerManager;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

public class FlunkerCanvas extends Canvas {
    
    private FlunkerManager flunker_manager;
    private FlunkerKeyHandler flunker_key_handler;
    
    public FlunkerCanvas(FlunkerManager manager){
        flunker_manager = manager;
        flunker_key_handler = new FlunkerKeyHandler(manager, this);
    }
    
    protected void paint(Graphics graphics) {
        flunker_manager.paint(graphics);
    }
    
    //Ask the FlunkerKeyHandler to handle the key events
    
    protected void keyPressed(int keyCode) { flunker_key_handler.keyEvent(flunker_key_handler.KEY_PRESSED, keyCode); }
   
    protected void keyReleased(int keyCode) { flunker_key_handler.keyEvent(flunker_key_handler.KEY_RELEASED, keyCode); }
    
    protected void keyRepeated(int keyCode) { flunker_key_handler.keyEvent(flunker_key_handler.KEY_REPEATED, keyCode); }
     
}